package com.itheima.d7_interface_demo;

import java.util.ArrayList;

public class StuManager {
    private ArrayList<Student> stus = new ArrayList<>();
    //保存要处理的数据
    //接口类型，引用实现类对象 体现多态
    private StudentOperator one = new OperatorOne();

    public StuManager(){
        stus.add(new Student("赵云",'男',90.2));
        stus.add(new Student("关羽",'男',57.4));
        stus.add(new Student("马超",'男',86.2));
        stus.add(new Student("张飞",'男',64.7));
        stus.add(new Student("黄忠",'男',72.4));
        stus.add(new Student("孙尚香",'女',92.6));
    }

    //打印学生信息
    public void printAll() {
//        OperatorOne one1 = new OperatorOne();
        one.PrintAll(stus);

    }
    public void printAvg() {
//        OperatorOne one2= new OperatorOne();
        one.PrintAvg(stus);
    }
}
